/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author elearning03
 */
import javax.swing.*;
import utilitarios.datos;
import Registros.*;
import utilitarios.beans_thread;
public class Ventanaprincipal extends javax.swing.JFrame {

    /**
     * Creates new form Ventanaprincipal
     */
    datos mostrar_datos;
    String set_look = "com.sun.java.swing.plaf.metal.MetalLookAndFeel";
    public Ventanaprincipal() 
    {
        initComponents();
        mostrar_datos = new datos();
        mostrar_datos.el_dato();//primero tengo que ejecutar este metodo para despues ejecutar el resto
        lbl_datos.setText("Hoy es "+mostrar_datos.dia_semana+ " "+mostrar_datos.dia+" de "+mostrar_datos.mes+" del año "+mostrar_datos.anho);
        timer1.start();
        //look and Feel
        try
        {
        //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
        SwingUtilities.updateComponentTreeUI(this);
        }
        catch (Exception error)
         {
           JOptionPane.showMessageDialog(null, error);
         }
       
        }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        timer1 = new org.netbeans.examples.lib.timerbean.Timer();
        lbl_datos = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        lbl_grafico = new javax.swing.JLabel();
        lbl_hora = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        menu_registros = new javax.swing.JMenu();
        miten_clientes = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JPopupMenu.Separator();
        miten_funcionarios = new javax.swing.JMenuItem();
        miten_cargo = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        miten_ciudades = new javax.swing.JMenuItem();
        miten_barrios = new javax.swing.JMenuItem();
        miten_proveedores = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        menu_stock = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        javax.swing.JMenuItem miten_dirección = new javax.swing.JMenuItem();
        miten_salir = new javax.swing.JMenuItem();
        menu_consultas = new javax.swing.JMenu();
        menu_reportes = new javax.swing.JMenu();
        menu_utilitarios = new javax.swing.JMenu();
        jMenuWindows = new javax.swing.JMenuItem();
        jMenuLiquid = new javax.swing.JMenuItem();
        jMenuMetal = new javax.swing.JMenuItem();
        jMenuGTK = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        menu_salir = new javax.swing.JMenu();

        timer1.addTimerListener(new org.netbeans.examples.lib.timerbean.TimerListener() {
            public void onTime(java.awt.event.ActionEvent evt) {
                timer1OnTime(evt);
            }
        });

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema para control de Stock");

        lbl_datos.setText("Datos:.");

        jPanel1.setBackground(new java.awt.Color(0, 153, 153));

        jButton1.setIcon(new javax.swing.ImageIcon("C:\\Proyectos\\stock\\ stock\\image\\cliente1.png")); // NOI18N
        jButton1.setText("Clientes");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addComponent(jButton1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(42, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addGap(35, 35, 35))
        );

        lbl_grafico.setIcon(new javax.swing.ImageIcon("C:\\Proyectos\\stock\\ stock\\image\\politecnica.png")); // NOI18N

        lbl_hora.setText("Hora");

        menu_registros.setMnemonic('R');
        menu_registros.setText("Registros");
        menu_registros.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menu_registrosActionPerformed(evt);
            }
        });

        miten_clientes.setIcon(new javax.swing.ImageIcon("C:\\Proyectos\\stock\\ stock\\image\\cliente1.png")); // NOI18N
        miten_clientes.setMnemonic('C');
        miten_clientes.setText("Clientes");
        miten_clientes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_clientesActionPerformed(evt);
            }
        });
        menu_registros.add(miten_clientes);
        menu_registros.add(jSeparator4);

        miten_funcionarios.setIcon(new javax.swing.ImageIcon("C:\\Proyectos\\stock\\ stock\\image\\funcionario.png")); // NOI18N
        miten_funcionarios.setMnemonic('F');
        miten_funcionarios.setText("Funcionarios");
        menu_registros.add(miten_funcionarios);

        miten_cargo.setIcon(new javax.swing.ImageIcon("C:\\Proyectos\\stock\\ stock\\image\\cargo.png")); // NOI18N
        miten_cargo.setText("Cargo");
        miten_cargo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_cargoActionPerformed(evt);
            }
        });
        menu_registros.add(miten_cargo);
        menu_registros.add(jSeparator3);

        miten_ciudades.setIcon(new javax.swing.ImageIcon("C:\\Proyectos\\stock\\ stock\\image\\ciudad.png")); // NOI18N
        miten_ciudades.setMnemonic('D');
        miten_ciudades.setText("Ciudades");
        miten_ciudades.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                miten_ciudadesMouseClicked(evt);
            }
        });
        miten_ciudades.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_ciudadesActionPerformed(evt);
            }
        });
        menu_registros.add(miten_ciudades);

        miten_barrios.setIcon(new javax.swing.ImageIcon("C:\\Proyectos\\stock\\ stock\\image\\barrio.png")); // NOI18N
        miten_barrios.setMnemonic('B');
        miten_barrios.setText("Barrio");
        miten_barrios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_barriosActionPerformed(evt);
            }
        });
        menu_registros.add(miten_barrios);

        miten_proveedores.setIcon(new javax.swing.ImageIcon("C:\\Proyectos\\stock\\ stock\\image\\mujer.png")); // NOI18N
        miten_proveedores.setMnemonic('P');
        miten_proveedores.setText("Proveedores");
        menu_registros.add(miten_proveedores);
        menu_registros.add(jSeparator2);

        menu_stock.setIcon(new javax.swing.ImageIcon("C:\\Proyectos\\stock\\ stock\\image\\stock.png")); // NOI18N
        menu_stock.setMnemonic('E');
        menu_stock.setText("Stock");

        jMenuItem1.setText("Implantación");
        menu_stock.add(jMenuItem1);

        jMenuItem2.setText("Entrada Stock");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        menu_stock.add(jMenuItem2);

        jMenuItem3.setText("Salida");
        menu_stock.add(jMenuItem3);

        menu_registros.add(menu_stock);
        menu_registros.add(jSeparator1);

        miten_dirección.setText("Dirección");
        miten_dirección.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_direcciónActionPerformed(evt);
            }
        });
        menu_registros.add(miten_dirección);

        miten_salir.setIcon(new javax.swing.ImageIcon("C:\\Proyectos\\stock\\ stock\\image\\salir.png")); // NOI18N
        miten_salir.setMnemonic('S');
        miten_salir.setText("Salir");
        menu_registros.add(miten_salir);

        jMenuBar1.add(menu_registros);

        menu_consultas.setMnemonic('K');
        menu_consultas.setText("Consultas");
        jMenuBar1.add(menu_consultas);

        menu_reportes.setMnemonic('T');
        menu_reportes.setText("Reportes");
        jMenuBar1.add(menu_reportes);

        menu_utilitarios.setMnemonic('U');
        menu_utilitarios.setText("Utilitarios");

        jMenuWindows.setText("Look And Feel - Windows");
        jMenuWindows.setName(""); // NOI18N
        jMenuWindows.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuWindowsActionPerformed(evt);
            }
        });
        menu_utilitarios.add(jMenuWindows);

        jMenuLiquid.setText("Look and Feel - Liquid");
        jMenuLiquid.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuLiquidActionPerformed(evt);
            }
        });
        menu_utilitarios.add(jMenuLiquid);

        jMenuMetal.setText("Look and Feel - Metal");
        jMenuMetal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuMetalActionPerformed(evt);
            }
        });
        menu_utilitarios.add(jMenuMetal);

        jMenuGTK.setText("Look and Feel - Nimbus");
        jMenuGTK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuGTKActionPerformed(evt);
            }
        });
        menu_utilitarios.add(jMenuGTK);

        jMenuItem4.setText("Ejemplo");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        menu_utilitarios.add(jMenuItem4);

        jMenuBar1.add(menu_utilitarios);

        menu_salir.setMnemonic('S');
        menu_salir.setText("Salir");
        menu_salir.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                menu_salirMouseClicked(evt);
            }
        });
        menu_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menu_salirActionPerformed(evt);
            }
        });
        jMenuBar1.add(menu_salir);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_datos)
                    .addComponent(lbl_hora))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 264, Short.MAX_VALUE)
                .addComponent(lbl_grafico, javax.swing.GroupLayout.PREFERRED_SIZE, 474, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 301, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_grafico, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(lbl_datos)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lbl_hora)
                        .addGap(18, 18, 18))))
        );

        setSize(new java.awt.Dimension(800, 600));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void miten_clientesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_clientesActionPerformed
        // TODO add your handling code here:
         new registro_cliente().show();
    }//GEN-LAST:event_miten_clientesActionPerformed

    private void miten_ciudadesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_ciudadesActionPerformed
        new registro_ciudad().show();
    }//GEN-LAST:event_miten_ciudadesActionPerformed

    private void miten_cargoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_cargoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_miten_cargoActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void timer1OnTime(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timer1OnTime
       mostrar_datos.leer_hora();
        lbl_hora.setText("Hora actual: "+mostrar_datos.hora);
    }//GEN-LAST:event_timer1OnTime

    private void menu_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menu_salirActionPerformed
       
    }//GEN-LAST:event_menu_salirActionPerformed

    private void menu_salirMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menu_salirMouseClicked
         System.exit(0);
    }//GEN-LAST:event_menu_salirMouseClicked

    private void jMenuWindowsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuWindowsActionPerformed
       set_look = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
       lookandfeel();
    }//GEN-LAST:event_jMenuWindowsActionPerformed

    private void jMenuLiquidActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuLiquidActionPerformed
        //set_look = "com.sun.java.swing.plaf.liquid.LiquidLookAndFeel";
        set_look = "com.birosoft.liquid.LiquidLookAndFeel";
       lookandfeel();

    }//GEN-LAST:event_jMenuLiquidActionPerformed

    private void jMenuMetalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuMetalActionPerformed
        set_look = "javax.swing.plaf.metal.MetalLookAndFeel";
       lookandfeel();

    }//GEN-LAST:event_jMenuMetalActionPerformed

    private void jMenuGTKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuGTKActionPerformed
        set_look = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel";
       lookandfeel();
    }//GEN-LAST:event_jMenuGTKActionPerformed

    private void miten_ciudadesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_miten_ciudadesMouseClicked
        new registro_ciudad().show();
    }//GEN-LAST:event_miten_ciudadesMouseClicked

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        new registro_ciudad().show();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        new beans_thread().show();
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void miten_barriosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_barriosActionPerformed
        // TODO add your handling code here:
        new registro_barrio().show();
    }//GEN-LAST:event_miten_barriosActionPerformed

    private void menu_registrosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menu_registrosActionPerformed
        // TODO add your handling code here:
        new registro_direccion().show();
    }//GEN-LAST:event_menu_registrosActionPerformed

    private void miten_direcciónActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_direcciónActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_miten_direcciónActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Ventanaprincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Ventanaprincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Ventanaprincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Ventanaprincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Ventanaprincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuGTK;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuLiquid;
    private javax.swing.JMenuItem jMenuMetal;
    private javax.swing.JMenuItem jMenuWindows;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JPopupMenu.Separator jSeparator4;
    private javax.swing.JLabel lbl_datos;
    private javax.swing.JLabel lbl_grafico;
    private javax.swing.JLabel lbl_hora;
    private javax.swing.JMenu menu_consultas;
    private javax.swing.JMenu menu_registros;
    private javax.swing.JMenu menu_reportes;
    private javax.swing.JMenu menu_salir;
    private javax.swing.JMenu menu_stock;
    private javax.swing.JMenu menu_utilitarios;
    private javax.swing.JMenuItem miten_barrios;
    private javax.swing.JMenuItem miten_cargo;
    private javax.swing.JMenuItem miten_ciudades;
    private javax.swing.JMenuItem miten_clientes;
    private javax.swing.JMenuItem miten_funcionarios;
    private javax.swing.JMenuItem miten_proveedores;
    private javax.swing.JMenuItem miten_salir;
    private org.netbeans.examples.lib.timerbean.Timer timer1;
    // End of variables declaration//GEN-END:variables

    public void lookandfeel()
    {
     try
        {
        //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        UIManager.setLookAndFeel(set_look);
        SwingUtilities.updateComponentTreeUI(this);
        }
        catch (Exception error)
         {
           JOptionPane.showMessageDialog(null, error);
         }  
    
    }


}
